import { WarScoreView } from "../guildWar/WarScoreView";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { SecTimerView } from "../common/SecTimerView";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { GameDefConfig } from "../../resource/GameDefConfig";
import { EForce } from "../../../../Message/Public/EForce";
import { ViewEvent } from "../../../mvc/events/ViewEvent";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { SNewBattleMyScore } from "../../../../Message/Public/SNewBattleMyScore";
import { SNewBattleFieldForceScore } from "../../../../Message/Public/SNewBattleFieldForceScore";
import { ObjTeamCreate } from "../common/ObjTeamCreate";
type int = number;
//class NewBattlefieldMiniScoreView
    
    export  class NewBattlefieldMiniScoreView extends WarScoreView
    {
        constructor()
        {
            super();
            this.y = 140;
            this.mouseEnabled = false;
            this.addListeners();
            return;
        }

        protected /* override */ initUI(): void
        {
            var loc1=null;
            var loc2=null;
            super.initUI();
            mouseEnabled = false;
            this._tfMyKill = ObjCreate.createTextField(Language.getStringByParam(41623, "0"), 50, 9, 80, 20, _spContent);
            this._tfMyHonor = ObjCreate.createTextField(Language.getStringByParam(41624, "0"), 143, 9, 100, 20, _spContent);
            this._secTimerView = new SecTimerView();
            this._secTimerView.setParse(Language.getString(41660));
            this._secTimerView.defaultTextFormat = GlobalStyle.textFormat6;
            ObjCreate.setObjAttri(this._secTimerView, 60, 33, 150, 20, _spContent);
            loc2 = GameDefConfig.instance.getForceShort(EForce._EForceRed);
            loc1 = new Object /* flash.display.Sprite */();
            ObjCreate.setObjAttri(loc1, 0, 57, -1, -1, _spContent);
            this._tfForce1 = ObjCreate.createTextField("", 8, 0, 40, 20, loc1);
            this._tfForce1.htmlText = "<font color=\'" + loc2.text1 + "\' size = \'14\'>" + loc2.name + "</font>";
            this._tfForce1ProtectTower = ObjCreate.createTextField(Language.getString(41661) + "0", 50, 0, 70, 20, loc1);
            this._tfForce1Tower = ObjCreate.createTextField(Language.getString(41662) + "0", 115, 0, 70, 20, loc1);
            this._tfForce1Kill = ObjCreate.createTextField(Language.getString(41663) + "0", 180, 0, 70, 20, loc1);
            loc2 = GameDefConfig.instance.getForceShort(EForce._EForceYellow);
            loc1 = new Object /* flash.display.Sprite */();
            ObjCreate.setObjAttri(loc1, 0, 85, -1, -1, _spContent);
            this._tfForce2 = ObjCreate.createTextField("", 8, 0, 40, 20, loc1);
            this._tfForce2.htmlText = "<font color=\'" + loc2.text1 + "\' size = \'14\'>" + loc2.name + "</font>";
            this._tfForce2ProtectTower = ObjCreate.createTextField(Language.getString(41661) + "0", 50, 0, 70, 20, loc1);
            this._tfForce2Tower = ObjCreate.createTextField(Language.getString(41662) + "0", 115, 0, 70, 20, loc1);
            this._tfForce2Kill = ObjCreate.createTextField(Language.getString(41663) + "0", 180, 0, 70, 20, loc1);
            return;
        }

        protected /* override */ initSize(): void
        {
            _bgW = 260;
            _bgH = 120;
            return;
        }

        /* internal  */addListeners(): void
        {
            this.addEventListener(ViewEvent.Hide, this.onHide);
            return;
        }

        /* internal  */onHide(arg1: ViewEvent): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.NewBattlefieldShowOrHideTop, false));
            return;
        }

        protected /* override */ onShowDetailsHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.NewBattlefieldAutoShowOrHideTop));
            return;
        }

        public updateMyScore(arg1: SNewBattleMyScore): void
        {
            this._tfMyKill.text = Language.getStringByParam(41623, arg1.killPlayer.toString());
            this._tfMyHonor.text = Language.getStringByParam(41624, arg1.honor.toString());
            return;
        }

        public updateCampScore(arg1: SNewBattleFieldForceScore, arg2: SNewBattleFieldForceScore): void
        {
            var loc1=null;
            loc1 = GameDefConfig.instance.getForceShort(EForce._EForceRed);
            ObjTeamCreate.setTextFieldKeyValue(this._tfForce1ProtectTower, Language.getString(41661), arg1.existTowerNum.toString(), loc1.text1, "#f0ea3f");
            ObjTeamCreate.setTextFieldKeyValue(this._tfForce1Tower, Language.getString(41662), arg1.killTowerNum.toString(), loc1.text1, "#f0ea3f");
            ObjTeamCreate.setTextFieldKeyValue(this._tfForce1Kill, Language.getString(41663), arg1.killPlayerNum.toString(), loc1.text1, "#f0ea3f");
            loc1 = GameDefConfig.instance.getForceShort(EForce._EForceYellow);
            ObjTeamCreate.setTextFieldKeyValue(this._tfForce2ProtectTower, Language.getString(41661), arg2.existTowerNum.toString(), loc1.text1, "#f0ea3f");
            ObjTeamCreate.setTextFieldKeyValue(this._tfForce2Tower, Language.getString(41662), arg2.killTowerNum.toString(), loc1.text1, "#f0ea3f");
            ObjTeamCreate.setTextFieldKeyValue(this._tfForce2Kill, Language.getString(41663), arg2.killPlayerNum.toString(), loc1.text1, "#f0ea3f");
            return;
        }

        public startCountdown(arg1: Date): void
        {
            return;
        }

        public updateLeftTime(arg1: int): void
        {
            this._secTimerView.setLeftTime(arg1);
            return;
        }

        public stopCountDown(): void
        {
            this._secTimerView.stop();
            return;
        }

        /* internal */ /* var */_tfMyKill: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfMyHonor: Object /* flash.text.TextField */;

        /* internal */ /* var */_secTimerView: SecTimerView;

        /* internal */ /* var */_tfForce1: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfForce1ProtectTower: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfForce1Tower: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfForce1Kill: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfForce2: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfForce2ProtectTower: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfForce2Tower: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfForce2Kill: Object /* flash.text.TextField */;
    }
